PartialReplica Property Example

The following code example uses the PartialReplica property to replicate all records representing orders from customers in California:

Sub PartialReplicaX()

   ' Assumptions: dbsTemp is the partial replica and
   ' appropriate relationships already exist between
   ' the tables.

   Dim tdfOrders As TableDef
   Dim relCustOrd As Relation
   Dim dbsTemp As Database
   Dim relLoop As Relation

   Set dbsTemp = OpenDatabase("Northwind.mdb")
   Set tdfOrders = dbsTemp.TableDefs("Orders")

   ' Find the "Customers to Orders" Relation object.
   For Each relLoop In dbsTemp.Relations
      If relLoop.Table = "Customers" And _
            relLoop.ForeignTable = "Orders" Then
         ' Set the Relation object's PartialReplica
         ' property to True.
         relLoop.PartialReplica = True
         Exit For
      End If
   Next relLoop

End Sub

Note If you have set a replica filter and a replica relation on the same table, the two act in combination as a logical OR operation, not a logical AND operation. For instance, in the preceding example, the records exchanged during synchronization are all orders greater than $1000 OR all orders from the California region, not all orders from the California region that are over $1000.